{include file=comm/head.html}

{include file=comm/top.html}

<div class="container pages">
	{include file=comm/position.html}
	<h2 class="text-center my-4 fs-sm-28 fs-24">{content:title}</h2>
	<div class="content">
		<h3>定制标签-多图文</h3>
		<div class="flex" style="display: flex;">
			{pboot:labelpics field=imgtext_1}
			<div class="item">
				<img src="[labelpics:src]" alt="[labelpics:title]">
				<h4>[labelpics:title]</h4>
				<p>[labelpics:intro]</p>
			</div>
			{/pboot:labelpics}
		</div>
		<hr>
		{content:content}
		<br>

		{pboot:if({sort:scode}==11)}
		<br>
		<h3>在线留言</h3>
		<!-- 留言表单 -->
		<div class="row">
			<div class="col-lg-3"></div>
			<div class="col-12 col-lg-6">
		    	<form class="my-4" onsubmit="return subformMessage(this);">
		            <div class="form-group">
		                <label for="name">联系人</label>
		                <div>
		                    <input type="text" name="contacts" required id="contacts" class="form-control" placeholder="请输入联系人">
		                </div>
		            </div>
		            
		            <div class="form-group">
		                <label for="mobile">手　机</label>
		                <div>
		                    <input type="text" name="mobile" required id="mobile" class="form-control" placeholder="请输入联系人手机">
		                </div>
		            </div>

		            <div class="form-group">
		                <label for="email">邮 箱</label>
		                <div>
		                    <input type="text" name="email" required id="email" class="form-control" placeholder="请输入联系人邮箱">
		                </div>
		            </div>

		            <div class="form-group">
		                <label for="address">地 址</label>
		                <div>
		                    <input type="text" name="address" required id="address" class="form-control" placeholder="请输入联系人地址">
		                </div>
		            </div>
		            
		            <div class="form-group">
		                <label for="content" >内　容</label>
		                <div>
		                    <textarea name="content" id="content" class="form-control" placeholder="请输入留言内容"></textarea>
		                </div>
		            </div>
		            
		            {pboot:2if({pboot:msgcodestatus})}
		            <div class="form-group">
		                <label for="checkcode">验证码</label>
		                <div class="row">
		                    <div class="col-6">
		                        <input type="text" name="checkcode" required id="checkcode" class="form-control" placeholder="请输入验证码">
		                    </div>
		                    <div class="col-6">
		                        <img title="点击刷新" class="codeimg" style="height:33px;" src="{pboot:checkcode}" onclick="this.src='{pboot:checkcode}?'+Math.round(Math.random()*10);" />
		                    </div>
		                </div>
		            </div>
		            {/pboot:2if}
		            
		            <div class="form-group">
		               <button type="submit" class="btn btn-info mb-2">提交留言</button>
		            </div>
		        </form>
		    </div>
		    <div class="col-lg-3"></div>
		</div> 
		{/pboot:if}
	</div>
</div>
<script>

//ajax提交留言
function subformMessage(obj){
  var url = '{pboot:form fcode=3}';
  var contacts=$(obj).find("#contacts").val();
  var mobile=$(obj).find("#mobile").val();
  var email=$(obj).find("#email").val();
  var address=$(obj).find("#address").val();
  var content=$(obj).find("#content").val();
  var checkcode=$(obj).find("#checkcode").val();
  
  $.ajax({
    type: 'POST',
    url: url,
    dataType: 'json',
    data: {
    	contacts: contacts,
    	mobile: mobile,
    	email: email,
    	address: address,
    	content: content,
    	checkcode: checkcode
    },
    success: function (response, status) {
    	
      if(response.code){
		 alert("谢谢您的反馈，我们会尽快联系您！");
		 $(obj)[0].reset(); 
      }else{ 
    	 if(response.tourl!=""){
    		 if(confirm(response.data+'是否立即跳转登录？')){
    			 location.href=response.tourl; 
   	   	     }
    	 } else {
    	 	console.log(response);
    	 }
    	 $('.codeimg').click();//更新验证码
      }
    },
    error:function(xhr,status,error){
      alert('返回数据异常！');
    }
  });
  return false;
}
</script>

{include file=comm/foot.html}
